﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;

namespace Kokomo.Environment.Commanding
{
	/// <summary>
	/// Represents a command in the UI.
	/// </summary>
	/// <remarks>
	/// Objects of this type may be displayed in menus,
	/// on toolbars, or as hyperlinks.  When activated,
	/// the environment executes <see cref="Command"/>,
	/// passing the value of <see cref="Argument"/>.
	/// </remarks>
	public class CommandViewModel
	{
		/// <summary>
		/// Initializes a new instance of <see cref="CommandViewModel"/>.
		/// </summary>
		/// <param name="command">The command.</param>
		/// <param name="text">The text to display.</param>
		/// <param name="iconSource">The icon to display.</param>
		/// <exception cref="ArgumentNullException"><paramref name="command"/> is <c>null</c>.</exception>
		/// <exception cref="ArgumentNullException"><paramref name="text"/> is <c>null</c>.</exception>
		public CommandViewModel(
			ICommand command,
			UiString text,
			ImageSource iconSource = null
			)
		{
			if (command == null) throw new ArgumentNullException("command");
			if (text == null) throw new ArgumentNullException("text");

			this.Command = command;
			this.Text = text;
			this.IconSource = iconSource;
		}

		/// <summary>
		/// Gets the command to execute.
		/// </summary>
		public ICommand Command { get; private set; }
		/// <summary>
		/// Gets or sets the argument to pass to the command.
		/// </summary>
		public object Argument { get; set; }
		/// <summary>
		/// Gets the text to display.
		/// </summary>
		public UiString Text { get; private set; }
		/// <summary>
		/// Gets the icon to display.
		/// </summary>
		public ImageSource IconSource { get; private set; }
	}
}
